/**
 * File: protocol.h
 * Brief:
 * Created by: zhangping
 * Created at: 2017.06.5
 * Modified by:
 * Modified at:
 **/
 
#ifndef _MY_PROTOCOL_H_
#define _MY_PROTOCOL_H_


enum InsEnum{
  kVelMode=0,  // Work at Velocity model
  kPosMode=1   // Work at Position model
};


typedef unsigned char U8;

/** Institution protocol format*/
struct InsProtocol{
  U8 header1;
  U8 header2;
  U8 mode;
  U8 x[2];
  U8 y[2];
  U8 z[2];
  U8 orientation;
};

/** Instruction data*/
static const struct InsProtocol kInsProtocol[]={
  { 0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // Velocity mode
  { 0xff,0xfe,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // Position mode
};


/** Sensor data */
/** Ultrasonic data */
struct UltrasonicData{
  U8 header;
  U8 type;
  U8 range;	 // distance
  U8 angle;  //
  U8 end;
};


/** Position data */
struct PositionData{
  U8 header;
  U8 type;
  U8 sensor_id;
  U8 x;
  U8 y;
  U8 z;
  U8 end;
};

/** union for Sensor data  */
union SensorData{
  UltrasonicData ult;
  PositionData pos;
};



#endif

